package cn.itcast.crm.service;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import cn.itcast.crm.domain.Customer;
//返回对象用produces,传对象时用consumers
public interface CustomerService {

	//查询所有未关联的客户
	@Path("/noassociationcustomers")
	@GET
	@Produces({"application/xml","application/json"})
	public List<Customer> findNoAssociationCustomers();
	
	//查询已关联指定快递员的客户
	@Path("/associationfixedareacustomers/{fixedAreaId}")
	@GET
	@Produces({"application/xml","application/json"})
	public List<Customer> findHasAssociationFixedAreaCustomers(@PathParam("fixedAreaId") String fixedAreaId);

	//将客户关联到定区上,将所有客户id拼成字符串1,2,3
	@Path("/associationcustomerstofixedarea")
	@PUT
	public void associationCustomersToFixedArea(@QueryParam("customerIdStr") String customerIdStr,@QueryParam("fixedAreaId") String fixedAreaId);

	//注册成功后保存客户操作
	@Path("/customer")
	@POST
	@Consumes({"application/xml","application/json"})
	public void regist(Customer customer);
	
	//通过telephone查询出客户
	@Path("/customer/telephone/{telephone}")
	@GET
	@Produces({"application/xml","application/json"})
	public Customer findByTelephone(@PathParam("telephone") String telephone);
	
	//绑定邮箱操作,即将该客户的type属性改为1
	@Path("/customer/updatetype/{telephone}")
	@GET
	public void updateType(@PathParam("telephone") String telephone);
	
	//客户登录
	@Path("/customer/login")
	@GET
	@Produces({"application/xml","application/json"})
	//路径中有参数的话方法里面用pathparam,路径中没有的话,就用queryparam
	public Customer login(@QueryParam("telephone") String telephone,@QueryParam("password") String password);

	//根据地址获取定区编码
	//客户下单时填写的地址与客户地址完全匹配时,自动分单
	@Path("/customer/findFixedAreaIdByAddress")
	@GET
	public String findFixedAreaIdByAddress(@QueryParam("address") String address);
}
